﻿using Snippet2Vsi.Classes;
using Snippet2Vsi.ViewModels;

namespace Snippet2Vsi.UserControls
{
    /// <summary>
    /// Interaction logic for SnippetEditor.xaml
    /// </summary>
    public partial class SnippetEditorView
    {
        private readonly SnippetEditorViewModel _model;
        public SnippetEditorView()
        {
            _model=new SnippetEditorViewModel(this);
            DataContext = _model;
            InitializeComponent();
        }

        private void XmlEditorSizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            TryCatch.BeginTryCatch(ResizeXmlEditor);
        }

        private void ResizeXmlEditor()
        {
            var userControlHeight = ActualHeight;
            var desiredHeight = userControlHeight - 35 - 27;
            xmlEditor.Height = desiredHeight;
        }
    }
}
